package com.xmim.fulcrum.node;

import com.xmim.core.entity.UserDetail;

import java.util.Objects;

/**
 * IM节点的POJO类
 * create by CAOYOU
 **/

public class DefaultFulcrumUserNode extends DefaultFulcrumNode implements FulcrumUserNode {

    private String userId;
    private String sessionId;


    private UserDetail user;

    public void setUser(UserDetail user) {
        this.user = user;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }


    @Override
    public UserDetail getUser() {
        return user;
    }

    @Override
    public String getUserId() {
        return userId;
    }

    @Override
    public String getSessionId() {
        return sessionId;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DefaultFulcrumUserNode node = (DefaultFulcrumUserNode) o;
        return Objects.equals(host, node.host)
                && Objects.equals(port, node.port)
                && Objects.equals(userId, node.userId)
                && Objects.equals(sessionId, node.sessionId);
    }

    @Override
    public String toString() {
        return "DefaultFulcrumUserNode{" +
                "userId='" + userId + '\'' +
                ", sessionId='" + sessionId + '\'' +
                ", user=" + user +
                ", id=" + id +
                ", host='" + host + '\'' +
                ", port=" + port +
                ", path='" + path + '\'' +
                '}';
    }
}
